<?php

require_once "skindetection.php";

$input_file = "images/example1.jpg";
$output_file = "output1.png";

$skindetection = new SkinDetection($input_file, $output_file);
$skindetection->loadSkinColors("skin_colors.txt");
$skindetection->setThresholdH(0.04, 0.04);
$skindetection->setThresholdS(0.09, 0.09);
#$skindetection->enableResize(50);
#$skindetection->enableImageMagick();
$process = $skindetection->process();

echo "<h1>".$input_file."</h1>";
echo "<img src=\"".$input_file."\" /> ";
echo "<img src=\"".$output_file."\" />";

echo "<br /><br />";
echo "pixels overall: ".$process["pixels_all"]."<br />";
echo "pixels skin: ".count($process["pixels_skin"])."<br />";
echo "percent skin: ".round($process["percent"] * 100, 2)." %";

echo "<h1>Loaded Skin Colors</h1>";
$skin_colors = $skindetection->getSkinColors();

foreach ($skin_colors as $color){
	echo "<div style=\"float:left; width:20px; height:10px; background-color:rgb(".implode(",", $color).");\"></div>";
}